package main

import (
	"fmt"
	"reflect"
)

func reflectSetValue(x interface{}) {
	v := reflect.ValueOf(x)
	t := v.Elem().Kind()
	if t == reflect.Int64 {
		v.Elem().SetInt(200)
	} else if t == reflect.String {
		v.Elem().SetString("hello world")
	}
}

func main() {
	var a int64 = 100
	reflectSetValue(&a)
	fmt.Printf("a的值为：%v\n", a)

	var b string = "hahaha"
	reflectSetValue(&b)
	fmt.Printf("b的值为：%v\n", b)
}